import request from '@/utils/request'

// 获取角色列表
export const getRoleList = (params: any) => {
    return request('/api/roles', 'get', params)
}

// 添加角色
export const addRole = (data: any) => {
    return request('/api/roles', 'post', data)
}

// 编辑角色
export const editRole = (id: any, data: any) => {
    return request(`/api/roles/${id}`, 'put', data)
}

// 删除角色
export const deleteRole = (id: any) => {
    return request(`/api/roles/${id}`, 'delete')
}

// 获取角色的菜单权限
export const getRoleMenus = (roleId: any) => {
    return request(`/api/roles/${roleId}/menu-tree`, 'get')
}

// 更新角色的菜单权限
export const updateRoleMenus = (roleId: any, menuIds: any) => {
    return request(`/api/roles/${roleId}/menus`, 'post', { menuIds })
} 